<template>
  <div>
    <el-form :model="form" :rules="rules" ref="form">
      <el-form-item label="Parent's Son" prop="parent.son">
        <el-input v-model="form.parent.son"></el-input>
      </el-form-item>
      <el-form-item label="Name" prop="name">
        <el-input v-model="form.name"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm">Submit</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        parent: {
          son: ''
        },
        name: ''
      },
      rules: {
        parent: {
          son: [
            { required: true, message: "Please enter parent's son's name", trigger: 'blur' }
          ]
        },
        name: [
          { required: true, message: 'Please enter your name', trigger: 'blur' }
        ]
      }
    }
  },
  methods: {
    submitForm() {
      this.$refs.form.validate(valid => {
        if (valid) {
          alert('Form submitted successfully')
        } else {
          alert('Form validation failed')
        }
      })
    }
  }
}
</script>